cli/rev-parse: Add `--single` option
authorColin Walters <walters@verbum.org>
Tue, 16 Aug 2022 21:27:46 +0000 (17:27 -0400)
committerColin Walters <walters@verbum.org>
Thu, 18 Aug 2022 15:08:17 +0000 (11:08 -0400)
commitad0354ac36aa2e7b0497f0e1636ee0d1a2d31033
treef127d04693bfb5b3e8d24a99d572dd98810e6be4
parentea2f0c294312240cbf1cc286bd71477d13cca89e
cli/rev-parse: Add `--single` option

In the current "ostree native container" flow, we're inserting
a commit object into the repo but with no refs.

We have hacks in a few places to find the commit digest via e.g.
`find repo/objects -name *.commit` but that's a horrible hack.
Add `ostree rev-parse --single` which will print the single commit,
and error out if there is not exactly one commit.

Co-authored-by: Jonathan Lebon <jonathan@jlebon.com>
man/ostree-rev-parse.xml
src/ostree/ot-builtin-rev-parse.c
tests/basic-test.sh